<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="http://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<script type="application/javascript">

  function send(url,type,data,func){
    $.ajax({
      type: type,
      dataType: 'json',
      data: JSON.stringify(data),
      contentType: "application/json; charset=utf-8",
      url: url,
      success: func
    });
  }
  function submit() {
    var js = {  username: 'react', password: 'express'}
    send('/api/auth/login','POST',js,function (result) {
    console.log(result);
    });
  }

</script>

<button type="button" onclick="submit()">submit</button>

</body>
</html>
